#include <stdio.h>

struct student{
    char name[10];
    int age;
};

struct student fun(struct student  std[], int  n)
{
    struct student max;
    int i;
    max=*std;
    for(i=0;i<n;i++)
    {
        if(max.age<std[i].age)
        max=std[i];
    }
    return max;

}

int main()
{
    int i=0,n = 0;
    struct student std[20]={};
    // struct student std[5]={
    //     {"aaa",17},
    //     {"bbb",18},
    //     {"ccc",19},
    //     {"ddd",20},
    //     {"eee",21}
    // };
    scanf("%d",&n);
    for(i = 0; i < n;i++)
    {
        scanf("%s",std[i].name);
        scanf("%d",&(std[i].age));
    }
    struct student max;
    max=fun(std,n);
    printf("%s %d\n", max.name,max.age);
}
